package com.fqgj.sentry.controller.antiFraud.response.gps;

import com.fqgj.common.utils.JSONUtils;

import java.io.Serializable;
import java.util.*;

/**
 * Created by liupengpeng on 2017/10/19.
 */
public class GpsInfoDataUtil implements Serializable {

    public static GpsInfoData getGpsInfoData() {
        GpsInfoData gpsInfoData = new GpsInfoData();
        List<GpsElement> provinceList = new ArrayList<>();

        GpsElement gpsElement = new GpsElement(10000,"申请量分布");
        List<GpsElementData> gpsElementDataList = new ArrayList<>();
        gpsElementDataList.add(new GpsElementData("北京", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("天津", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("上海", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("重庆", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("河北", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("安徽", new Random().nextInt(10000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("新疆", new Random().nextInt(5000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("浙江", new Random().nextInt(5000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("江西", new Random().nextInt(5000), getGpsElementDateDesc()));
        gpsElementDataList.add(new GpsElementData("山西", new Random().nextInt(5000), getGpsElementDateDesc()));
        gpsElement.setData(gpsElementDataList);
        provinceList.add(gpsElement);

        GpsElement oneDayOverdue = new GpsElement(100,"首逾分布率");
        List<GpsElementData> oneDayOverdueList = new ArrayList<>();
        oneDayOverdueList.add(new GpsElementData("内蒙古", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("吉林", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("福建", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("广东", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("西藏", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("安徽", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("四川", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("宁夏", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdueList.add(new GpsElementData("香港", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayOverdue.setData(oneDayOverdueList);
        provinceList.add(oneDayOverdue);


        GpsElement fifteenOverdue = new GpsElement(100,"d15分布率");
        List<GpsElementData> fifteenOverdueList = new ArrayList<>();
        fifteenOverdueList.add(new GpsElementData("北京", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("天津", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("上海", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("广东", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("香港", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("台湾", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdueList.add(new GpsElementData("澳门", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenOverdue.setData(fifteenOverdueList);
        provinceList.add(fifteenOverdue);


        List<GpsElement> area = new ArrayList<>();
        Map<String, Double[]> geoCoordMap = new HashMap<>();

        GpsElement areaApply = new GpsElement(10000,"申请量分布");
        List<GpsElementData> areaApplyList = new ArrayList<>();
        areaApplyList.add(new GpsElementData("海门", new Random().nextInt(10000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("鄂尔多斯", new Random().nextInt(10000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("招远", new Random().nextInt(10000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("舟山", new Random().nextInt(10000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("齐齐哈尔", new Random().nextInt(10000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("盐城", new Random().nextInt(5000), getGpsElementDateDesc()));
        areaApplyList.add(new GpsElementData("赤峰", new Random().nextInt(5000), getGpsElementDateDesc()));
        areaApply.setData(areaApplyList);

        geoCoordMap.put("海门", getDoubleArray("121.15", "31.89"));
        geoCoordMap.put("鄂尔多斯", getDoubleArray("109.781327", "39.608266"));
        geoCoordMap.put("招远", getDoubleArray("120.38", "37.35"));
        geoCoordMap.put("舟山", getDoubleArray("122.207216", "29.985295"));
        geoCoordMap.put("齐齐哈尔", getDoubleArray("123.97", "47.33"));
        geoCoordMap.put("盐城", getDoubleArray("120.13", "33.38"));
        geoCoordMap.put("赤峰", getDoubleArray("118.87", "42.28"));
        area.add(areaApply);


        GpsElement oneDayApply = new GpsElement(100,"首逾分布");
        List<GpsElementData> oneDayApplyList = new ArrayList<>();
        oneDayApplyList.add(new GpsElementData("青岛", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("乳山", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("金昌", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("舟山", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("齐齐哈尔", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("盐城", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApplyList.add(new GpsElementData("赤峰", new Random().nextInt(100), getGpsElementDateDesc()));
        oneDayApply.setData(oneDayApplyList);

        geoCoordMap.put("青岛", getDoubleArray("120.33", "36.07"));
        geoCoordMap.put("乳山", getDoubleArray("121.52", "36.89"));
        geoCoordMap.put("金昌", getDoubleArray("102.188043", "38.520089"));
        geoCoordMap.put("舟山", getDoubleArray("122.207216", "29.985295"));
        geoCoordMap.put("齐齐哈尔", getDoubleArray("123.97", "47.33"));
        geoCoordMap.put("盐城", getDoubleArray("120.13", "33.38"));
        geoCoordMap.put("赤峰", getDoubleArray("118.87", "42.28"));
        area.add(oneDayApply);


        GpsElement fifteenApplyArea = new GpsElement(100,"d15分布");
        List<GpsElementData> fifteenApplyAreaList = new ArrayList<>();
        fifteenApplyAreaList.add(new GpsElementData("泉州", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("日照", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("招远", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("舟山", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("齐齐哈尔", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("盐城", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyAreaList.add(new GpsElementData("赤峰", new Random().nextInt(100), getGpsElementDateDesc()));
        fifteenApplyArea.setData(fifteenApplyAreaList);

        geoCoordMap.put("泉州", getDoubleArray("118.58", "24.93"));
        geoCoordMap.put("日照", getDoubleArray("119.46", "35.42"));
        geoCoordMap.put("招远", getDoubleArray("120.38", "37.35"));
        geoCoordMap.put("舟山", getDoubleArray("122.207216", "29.985295"));
        geoCoordMap.put("齐齐哈尔", getDoubleArray("123.97", "47.33"));
        geoCoordMap.put("盐城", getDoubleArray("120.13", "33.38"));
        geoCoordMap.put("赤峰", getDoubleArray("118.87", "42.28"));
        area.add(fifteenApplyArea);

        gpsInfoData.setProvinceList(provinceList).setAreaList(area);
        gpsInfoData.setGeoCoordMap(geoCoordMap);

        return gpsInfoData;
    }

    private static Double[] getDoubleArray(String lat, String lng) {
        Double[] strArray = {Double.valueOf(lat), Double.valueOf(lng)};
        return strArray;
    }

    private static GpsElementDateDetail getGpsElementDateDesc() {
        GpsElementDateDetail gpsElementDateDetail = new GpsElementDateDetail();
        gpsElementDateDetail.setApplyNum(1000)
                .setPassNum(100)
                .setPassRate("10%")
                .setOneDayShouldPayNum(100)
                .setOneDayOverdueNum(30)
                .setOneDayOverdueRate("30%")
                .setFifteenShouldPayNum(100)
                .setFifteenOverdueNum(10)
                .setFifteenOverdueRate("10%")
                .setOnOverdueNum(10)
                .setOnOverdueRate("10%");
        return gpsElementDateDetail;

    }

    public static void main(String[] args) {
        GpsInfoData gpsInfoData = getGpsInfoData();
        try {
            System.out.println(JSONUtils.obj2json(gpsInfoData));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


}
